{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "81d28a18-3073-4961-bf1e-aa4defa2dca5",
   "metadata": {},
   "source": [
    "# Phi3.5-Mini大模型对话\n",
    "同济子豪兄 2024-8-31"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b79e475-345e-402e-913d-1bb7ab5dd950",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true
   },
   "source": [
    "## 本地部署大模型的五大好处\n",
    "\n",
    "同济子豪兄\n",
    "\n",
    "- 延迟为零，无需网络带宽\n",
    "\n",
    "- 成本为零，无限token调用\n",
    "\n",
    "- 风险为零，无惧隐私泄露\n",
    "\n",
    "- 门槛为零，端侧人人可用\n",
    "\n",
    "- 依赖为零，开源自主可控\n",
    "\n",
    "典型应用场景：智能座舱、无人驾驶、零售终端、AI PC、手机端侧AI、具身智能机器人、安防监控、公司内网知识库问答"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "adc96103-f19d-44f9-a40f-43b83d777730",
   "metadata": {},
   "source": [
    "## 导入工具包和模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "09487884-4518-4a80-8264-2da76bc8d6cc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "导入工具包\n",
      "开始载入phi3.5-mini-instruct-openvino-int4模型\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Compiling the model to GPU ...\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "模型成功载入\n"
     ]
    }
   ],
   "source": [
    "from utils_phi35 import *"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcb9f438-ec71-42fa-bee9-430dcb1929a8",
   "metadata": {},
   "source": [
    "## 和大模型对话"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "21a4af0f-c6b8-480b-94c2-e5fade5717ff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我是一个人工智能助理，设计为协助并回答您的问题。您可以询问关于各个主题，我会尽力提供有用的信息。\n"
     ]
    }
   ],
   "source": [
    "result = phi35_ask('你是谁呀')\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "24b178ea-ad6c-4aa2-a791-77ffd7c10795",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'我是一个人工智能助理，设计为协助并回答您的问题。您可以询问关于各个主题，我会尽力提供有用的信息。'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "617acd06-4ff2-4af9-8e04-5fa1795aac8f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
